<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../vue.js"></script>
</head>

<body>
    <div id="app">
        {{message}}
        <button @click="sub">点击</button>
    </div>
    <script type="module">
        // 扩展vue的功能 ：Vue.use();方法加载插件 import myfn from "./myfn.js"; Vue.use(myfn); new Vue({ el: "#app", data: { message: "数据", }, methods: { sub() { this.$fn(); }, }, });
    </script>
</body>

</html>